#ifndef PAGESWITCH_H
#define PAGESWITCH_H

#include <QWidget>
#include <QPushButton>
#include <QSignalMapper>
#include "globalconfig.h"
#include "aquam8628.h"
#include "aquam8212.h"
#include <QDebug>

namespace Ui {
class PageSwitch;
}

class PageSwitch : public QWidget
{
    Q_OBJECT

public:
    explicit PageSwitch(QWidget *parent = nullptr);
    ~PageSwitch();
    void setSwitchPortStat(int car,int switch_index,uint32_t IO_stat,uint32_t duplex_flt_stat);
    void updateSwitchPortName(int trainNumber);
private slots:
    void slot_SalSelect(int sal);
    void on_Btn_Return_clicked();
signals:
    void returnToMaintMenu();
private:
    Ui::PageSwitch *ui;
private:
    QList<QWidget*> switch_page_car_;
    QList<Switch*> switch_list_[6];
    QList<QPushButton*> change_sal_btn_list_;
    QStringList port_name_list_[5][2];
    QList<QLabel*> main_switch_ports_[6];
private:
    void InitSwithPages();
    void CreateBtnSlots();
    void updateMainSwitchPortStat(int car,int index, int port_stat, int duplex_stat);
    void changeComment(int sal);
};

#endif // PAGESWITCH_H
